function [h,T1,T2] = selectTwoBlock(coef, bx, by, dx, dy, target)
  % newtarget = (target+1)/2;
  [M,N]=size(coef);
  p = coef(bx:8:M, by:8:N);
  q = coef(dx:8:M, dy:8:N);
  [M1,N1] = size(p);
  p2 = reshape(p,1,M1*N1);
  q2 = reshape(q,1,M1*N1);
  T1 = selectRange(p2, target);
  T2 = selectRange(q2, target);
  %(p2,q2) in pairs
  h = histc2d(p2, q2, T1, T2);
  s = sum(sum(h));
  s
  if (s ~= 0)
      h = h/s;
  end
end
